﻿@model IEnumerable<DevExtreme.NETCore.Demos.Models.OrgItemPlain>

@(Html.DevExtreme().Diagram()
        .ID("diagram")
        .CustomShapes(cs => {
            foreach(var employee in Model) {
                cs.Add().Category("employees").Type("employee" + employee.ID).BaseType("rectangle").DefaultText(employee.FullName).AllowEditText(false);
            }
        })
        .Toolbox(tb => tb
            .Groups(g => g.Add().Category("employees").Title("Employees").DisplayMode(DiagramToolboxDisplayMode.Texts))
        )
)

<script type="text/javascript">
    $(function() {
        $.ajax({
            url: "@Url.Content("~/SampleData/diagram-employees.json")",
            dataType: "text",
            success: function(data) {
                $("#diagram").dxDiagram("instance").import(data);
            }
        });
    });
</script>
